<template>
	<view class="uni_box home">
		<navbar title='反馈记录'>
		</navbar>
		<view class="content">
			<view class="shenview" v-for="(item,index) in list" :key="index">
				<view class="shenone">
					<text class="cname">{{item.createtime}}</text>
				</view>
				<text class="fantit" v-if="item.content">反馈内容:</text>
				<text class="smiao" v-if="item.content">{{item.content}}</text>
				<text class="fantit" v-if="item.image">反馈图片:</text>
				<view class="tuview" v-if="item.image">
					<view class="tuitem" v-for="(i,ind) in item.image" :key="ind" @click="previewImage(i)">
						<image class="addtu" :src="i?i:'/static/img/btn_tupian.png'"></image>
					</view>
				</view>
				<text class="fantit zt">反馈状态:</text>
				<text class="ztname">{{item.status_text}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
				images:[{}]
			}
		},
		onLoad() {
			this.getList()
		},
		onShow() {
		},
		onReachBottom: function () {
			this.loadmore();
		},
		methods: {
			async getList(){//列表数据
				let res = await this.$u.api.getFankuiList({
					page:this.page,
				});
			this.last_page = res.lastpage;
			let list = res.list;
			this.list = this.page == 1 ? list : [...this.list, ...list];	
			if(this.page >= this.last_page){
				this.status = 'nomore';
			}
				
			},
			loadmore() {
				let page = this.page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			previewImage(item){
				// console.log('index', index)
				let a= []
				// let list = this.list
				// for(let i in list){
				a.push(item)
				// }
				uni.previewImage({
					current: item, //预览图片的下标
					urls: a//预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 30rpx;
		.shenview{
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 10rpx 20rpx 40rpx;
			margin-bottom: 30rpx;
			.zt{
				border-top: 1rpx solid #eee;
				padding-top: 20rpx;
			}
			.ztname{
				font-weight: 500;
				font-size: 26rpx;
				color: #ED2323;
			}
			.shenone{
				border-bottom: 1rpx solid #eee;
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 20rpx 0;
				.cname{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #111111;
				}
			}
			.smiao{
				display: block;
				font-family: PingFang SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #999999;
				
			}
			.fantit{
				font-weight: 500;
				font-size: 28rpx;
				color: #333333;
				margin-top: 30rpx;
				margin-bottom: 10rpx;
				display: block;
			}
		}
	}
	.tuview{
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;
			margin-top: 30rpx;
			.tuitem{
				width: 180rpx;
				height: 180rpx;
				position: relative;
				border-radius: 10rpx;
				margin: 0 20rpx 20rpx 0;
				.addtu{
					position: absolute;
					width: 100%;
					height: 100%;
					border-radius: 10rpx;
				}
				.cha{
					background-color: rgba(0, 0, 0, 0.4);
					position: absolute;
					width: 100%;
					height: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 10rpx;
					z-index: 10;
					text{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFFFFF;
					}
				}
			}
		}
	
</style>
